package cn.white.ymc.mvvmmaster.data.local;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;

import cn.white.ymc.mvvmmaster.data.bean.UserInfo;

/**
 * 用户 数据库 操作接口
 *
 * @packageName: cn.white.ymc.mvvmmaster.data.local
 * @fileName: UserInfoDao
 * @date: 2018/11/6  10:30
 * @author: ymc
 * @QQ:745612618
 */

@Dao
public interface UserInfoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long add(UserInfo userInfo);

    @Query("select * from user where login = :username")
    LiveData<UserInfo> queryByUsername(String username);

}
